var app = getApp();
var OrderByidUrl = "userOrderApi/selectOrderByid";

Page({
  data: {
    orderDetail:""
  },

  data: {
    orderDetail:""
  },
  onLoad: function (e) {
    wx.showLoading();
    var that = this;
    console.log(e)
    wx.request({
      url: app.globalData.requestUrl + OrderByidUrl,
      header: {
        'content-type': 'application/json'
      },
      method: 'POST',
      data: {//这里写你要请求的参数
        userID: app.globalData.userId,
        orderId:e.id
      },

      success: function (res) {
        wx.hideLoading();
        //将获取到的json数据，
        console.log(res);//打印日志

        that.setData({
          orderDetail: res.data.order,
        });
        var list = that.data.orderDetail;
        console.log(list);
          var Orderstatus;
          var status = list.status;
          var rateStatus = list.rateStatus;
          if (status == "C125001") {
            Orderstatus = "待发货";
          } else if (status == "C125003") {
            Orderstatus = "待收货";
          } else if (status == "C125005") {
            Orderstatus = "待付款";
          } else if (status == "C125004" && rateStatus == 0) {
            Orderstatus = "待评价";
          } else if (status == "C125004" && rateStatus == 1) {
            Orderstatus = "订单完成";
          } else if (status == "C125002" || status == "C125006") {
            Orderstatus = "取消订单";
          } else if (status == "C125007") {
            Orderstatus = "退款成功";
          } else if (status == "C125008") {
            Orderstatus = "退款处理中";
          } else {

          };
          var tempstatus = 'orderDetail.Orderstatus';
          that.setData({ //二次实例化
            [tempstatus]: Orderstatus
          })

       


      }
    });

   
  },
  remarked:function (e) {
    var that = this;
    // var value = e.detail.value;
    console.log(e.detail.value)
  },
  onShow: function () {
    var that = this;

  },
  // wuliuDetailsTap: function (e) {
  //   var orderId = e.currentTarget.dataset.id;
  //   wx.navigateTo({
  //     url: "/pages/wuliu/index?id=" + orderId
  //   })
  // },

})